<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script src="resources/common.js"></script>
</head>
<body>
<div id="console"></div>
<div id="elements">
<fieldset name=name01></fieldset>
<input name=name02 type=hidden>
<input name=name03 type=text>
<input name=name04 type=tel>
<input name=name05 type=url>
<input name=name06 type=email>
<input name=name07 type=password>
<input name=name09 type=date>
<input name=name10 type=month>
<input name=name11 type=week>
<input name=name12 type=time>
<input name=name13 type=datetime-local>
<input name=name14 type=number>
<input name=name15 type=range>
<input name=name16 type=color>
<input name=name17 type=checkbox>
<input name=name18 type=radio>
<input name=name19 type=file>
<input name=name20 type=submit>
<input name=name21 type=reset>
<input name=name22 type=button>
<button name=name23 type=submit></button>
<button name=name24 type=reset></button>
<button name=name25 type=button></button>
<select name=name26 ></select>
<select name=name27 multiple></select>
<textarea name=name28></textarea>
<output name=name30></output>
</div>
<script>
console.log('Test if state of stateless form control types are not saved.');
jsTestIsAsync = true;

if (window.internals) {
    var statefulTypes = ['text', 'tel', 'url', 'email', 'number', 'range', 'checkbox',
                            'radio', 'file', 'select-one', 'select-multiple', 'textarea'];
    var statelessTypes = ['fieldset', 'hidden', 'password', 'submit', 'reset', 'button', 'output'];

    var states = internals.formControlStateOfHistoryItem();
    for (var i = 0; i < statefulTypes.length; ++i) {
        if (states.indexOf(statefulTypes[i]) >= 0)
            testPassed('There is a state for ' + statefulTypes[i]);
        else
            testFailed('There no state for ' + statefulTypes[i]);
    }

    for (var i = 0; i < statelessTypes.length; ++i) {
        if (states.indexOf(statelessTypes[i]) < 0)
            testPassed('There is no state for ' + statelessTypes[i]);
        else
            testFailed('There is a state for ' + statelessTypes[i]);
    }
}
// Remove the input elements from the document to avoid a bunch of trailing
// whitespace in the test output.
document.body.removeChild(document.getElementById("elements"));
finishJSTest();
</script>
</body>
